﻿using System.Web.Mvc;
using Vidh.SimplyToDo.Controllers.ViewModels;

namespace Vidh.SimplyToDo.Controllers.Controller
{
    public class AccountController : BaseController
    {
        public ActionResult Register()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Register(RegisterModel model)
        {
            var valid = model.SignUp(ModelState);
            if (valid)
            {
                return RedirectToAction("Welcome", "Account");
            }

            return View();
        }

        [Authorize]
        public ActionResult Welcome()
        {
            return View(new WelcomeModel());
        }

        public ActionResult ForgotPassword()
        {
            return View();
        }

        [Authorize]
        public ActionResult Logout()
        {
            var model = new LoginModel();
            model.Logout();
            return RedirectToAction("Index", "Home");
        }
    }
}
